import openpyxl


class Excel_Data_AddUser:
    @staticmethod
    def read_adduser_success():
        wb = openpyxl.load_workbook(
            r"/WebAppTest/WebTest/WebAutomationEncapsulation/CaseFiles/adduser_demo.xlsx"
            )
        sheet = wb['新增用户成功']                        #登陆用的账号，密码，注册的账号，密码，真实姓名，手机号，邮箱，result
        data = [[sheet.cell(row=i,column=j).value for j in range(1,9)]  for i in range(2,sheet.max_row + 1)]
        return data
    @staticmethod
    def read_adduser_username_error():
        wb = openpyxl.load_workbook(
            r"/WebAppTest/WebTest/WebAutomationEncapsulation/CaseFiles/adduser_demo.xlsx"
            )
        sheet = wb['用户名错误'] #这里并不是显示用户名错误，而是包含用户名为空的多种情况
        data = [[sheet.cell(row=i,column=j).value for j in range(1,9)]  for i in range(2,sheet.max_row + 1)]
        print(data)#方便查找
        return data
    @staticmethod
    def read_adduser_password_error():
        wb = openpyxl.load_workbook(
            r"/WebAppTest/WebTest/WebAutomationEncapsulation/CaseFiles/adduser_demo.xlsx"
            )
        sheet = wb['密码错误'] #这里并不是显示用户名错误，而是包含用户名为空的多种情况
        data = [[sheet.cell(row=i,column=j).value for j in range(1,9)]  for i in range(2,sheet.max_row + 1)]
        return data        #row行
    @staticmethod
    def read_adduser_realname_error():
        wb = openpyxl.load_workbook(
            r"/WebAppTest/WebTest/WebAutomationEncapsulation/CaseFiles/adduser_demo.xlsx"
            )
        sheet = wb['真实姓名错误'] #这里并不是显示用户名错误，而是包含用户名为空的多种情况
        data = [[sheet.cell(row=i,column=j).value for j in range(1,9)]  for i in range(2,sheet.max_row + 1)]
        return data
    @staticmethod
    def read_adduser_phonenum_error():
        wb = openpyxl.load_workbook(
            r"/WebAppTest/WebTest/WebAutomationEncapsulation/CaseFiles/adduser_demo.xlsx"
            )
        sheet = wb['手机号错误'] #这里并不是显示用户名错误，而是包含用户名为空的多种情况
        data = [[sheet.cell(row=i,column=j).value for j in range(1,9)]  for i in range(2,sheet.max_row + 1)]
        return data
    @staticmethod
    def read_adduser_email_error():
        wb = openpyxl.load_workbook(
            r"/WebAppTest/WebTest/WebAutomationEncapsulation/CaseFiles/adduser_demo.xlsx"
            )
        sheet = wb['邮箱错误'] #这里并不是显示用户名错误，而是包含用户名为空的多种情况
        data = [[sheet.cell(row=i,column=j).value for j in range(1,9)]  for i in range(2,sheet.max_row + 1)]
        return data